<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->

<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

<!-- BEGIN HEAD -->
<%@ include file="/wx/include/i1510.jsp"%>
<%@ include file="/wx/include/inc_head.jsp"%>


<!-- BEGIN PAGE LEVEL STYLES -->
<link
	href="${pageContext.request.contextPath}/wx/media/css/select2_metro.css"
	rel="stylesheet" type="text/css" />
<link
	href="${pageContext.request.contextPath}/wx/media/css/DT_bootstrap.css"
	rel="stylesheet" type="text/css" />

<link
	href="${pageContext.request.contextPath}/wx/media/css/bootstrap-table.css"
	rel="stylesheet" type="text/css" />
<!-- END PAGE LEVEL STYLES -->

<!-- END HEAD -->

<!-- BEGIN BODY -->


<body class="page-header-fixed page-footer-fixed" style="">

	<!-- BEGIN HEADER -->

	<%@ include file="/wx/include/inc_head_sub.jsp"%>

	<!-- END HEADER -->

	<!-- BEGIN CONTAINER -->

	<div class="page-container">

		<!-- BEGIN SIDEBAR -->

		<%@ include file="/wx/include/inc_sidebar.jsp"%>

		<!-- END SIDEBAR -->

		<!-- BEGIN PAGE -->

		<div class="page-content">

			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->


			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->

			<!-- BEGIN PAGE CONTAINER-->

			<div class="container-fluid">

				<!-- BEGIN PAGE HEADER-->

				<div class="row-fluid">

					<div class="span12">

						<!-- BEGIN PAGE TITLE & BREADCRUMB-->

						<ul class="breadcrumb">

							<li><i class="icon-home"></i> <a
								href="${pageContext.request.contextPath}/wx/main/index.jsp"><small>主页</small></a>

								<i class="icon-angle-right"></i></li>

							<li><a href="#"><small>配置管理</small></a></li>



						</ul>

						<h3 class="page-title">

							公众号配置<small>【公众号A】</small>

						</h3>

						<!-- END PAGE TITLE & BREADCRUMB-->

					</div>

				</div>

				<!-- END PAGE HEADER -->
				<!-- BEGIN 内容 -->
				<form role="form"  id="sumbitForm">
					<div class="form-group">
						<label for="name">微信号</label> 
							<input type="text" class="form-control" placeholder="文本输入" name="docSubject">
						<label for="name">ID</label>
							<input type="text" class="form-control" placeholder="文本输入" name="docId">
						<label for="name">名称</label>
							<input type="text" class="form-control" placeholder="文本输入" name="name">
						<label for="name">邮件</label>
							<input type="text" class="form-control" placeholder="文本输入" name="email">
						<label for="name">类型</label>
						<div>   
						   <label class="checkbox-inline">
						      <input type="radio" name="type" id="type10" value="10">服务号
						   </label>
						   <label class="checkbox-inline">
						      <input type="radio" name="type" id="type20" value="20">企业号
						   </label>
						   <label class="checkbox-inline">
						      <input type="radio" name="type" id="type00" value="00" checked>订阅号
						   </label>
						</div>
						<label for="name">头像</label>
							<input type="text" class="form-control" placeholder="文本输入" name="pic">
						<label for="name">描述</label>
							<textarea class="form-control" rows="3" name="descs" placeholder="文本输入"></textarea>
						<label for="name">主体信息</label>
							<input type="text" class="form-control" placeholder="文本输入" name="info">
						<label for="name">二维码</label>
							<input type="text" class="form-control" placeholder="文本输入" name="qrcode">
						<label for="name">地址</label>
							<textarea class="form-control" rows="3" name="address" placeholder="文本输入"></textarea>
						<label for="name">接口URL</label>
							<input type="text" class="form-control" placeholder="文本输入" name="intUrl">
						<label for="name"> 接口TOKEN</label>
							<input type="text" class="form-control" placeholder="文本输入" name="intToken">
						<label for="name">AppId</label>
							<input type="text" class="form-control" placeholder="文本输入" name="appId">
						<label for="name">AppSecret</label>
							<input type="text" class="form-control" placeholder="文本输入" name="appSecret">
						<label for="name">企业系统URL</label>
							<input type="text" class="form-control" placeholder="文本输入" name="qyUrl">
						<label for="name">企业系统Licence</label>
							<input type="text" class="form-control" placeholder="文本输入" name="qyLicense">
						<label for="name">企业系统密钥</label>
							<input type="text" class="form-control" placeholder="文本输入" name="qyKey">
						<label for="name">企业系统密码</label>
							 <input type="password" class="form-control" id="qyPw" name="qyPw" placeholder="请输入密码">
						<label for="name">当前状态</label>
						<div>   
						   <label class="checkbox-inline">
						      <input type="radio" name="docStatus" id="docStatus10" value="10">未认证
						   </label>
						   <label class="checkbox-inline">
						      <input type="radio" name="docStatus" id="docStatus20" value="20">已认证
						   </label>
						   <label class="checkbox-inline">
						      <input type="radio" name="docStatus" id="docStatus00" value="00" checked>删除
						   </label>
<button type="button" class="btn-primary" id="btn_submit">
      提交
   </button>
<span id="info-pop" class="btn-warning" title="Tip"  data-toggle="popover" data-placement="top" trigger="hover"
      data-content="">
      Tip
   </span>
						</div>
					</div>
				</form>

				<!-- END 内容 -->

			</div>

			<!-- END PAGE CONTAINER-->

		</div>

		<!-- END PAGE -->

	</div>

	<!-- END CONTAINER -->

	<!-- BEGIN FOOTER -->

	<%@ include file="/wx/include/inc_foot.jsp"%>

	<!-- END FOOTER 测试使用 include file="/wx/include/inc_foot_js.jsp"-->

</body>
<script>
function _view(id){
	var parameter = new Object();
	parameter["docId"] = id;
	jQuery.ajax({
	    type: "GET",
		cache: false,
		data:parameter,
		url: "${pageContext.request.contextPath}/admin/wxPublic/view.do",
		dataType:'json',
		success: function(value){
			var dataList = value.data;
			var dataInput = $("#sumbitForm").find(":input");
			$.each(dataInput, function(i, item) {
				if(item.type == "radio" ){
					if(item.value == dataList[item.name]){
						$("#"+item.id).attr("checked","");
					}else{
						$("#"+item.id).removeAttr("checked");
					}
				}else{
					item.value = dataList[item.name];					
				}
			});
			
		},		       
        error: function(jqXHR , textStatus , errorThrown){
        	alert("--error");
        }
	})
}
	function _submit(){
		jQuery.ajax({
		    type: "POST",
			cache: false,
			data:$('#sumbitForm').serialize(),
			url: "${pageContext.request.contextPath}/admin/wxPublic/save.do",
			dataType:'json',
			success: function(value){
				if(value.result == "success" && value.code == "1"){
					$("#info-pop").attr("class","btn-success");
					$("#info-pop").attr("data-content","提交成功!");
					$('#info-pop').popover('show');
					setTimeout("_hidePop();", 3000);						
				}else{
					$("#info-pop").attr("class","btn-warning");
					$("#info-pop").attr("data-content","提交失败请重试!");
					$('#info-pop').popover('show');
					setTimeout("_hidePop();", 3000);
				}
			},		       
	        error: function(jqXHR , textStatus , errorThrown){
	        	alert("--error");
	        }
		})
	}
	function _hidePop(){
		$('#info-pop').popover('hide');
	}
	$(function () {
		var id = "${param.id}";
		if(id != null && id != ""){
			_view(id);
		}
		jQuery("#btn_submit").bind("click",_submit);
		jQuery("#info-pop").bind("click",_hidePop);
	});
</script>
<!-- END BODY -->

</html>